<?php
	require_once "Zend/Application.php";
	
	// Define path to application directory
	defined("APPLICATION_PATH") || define("APPLICATION_PATH", realpath(dirname(__FILE__) . "/../application"));
	
	// Define application environment
	defined("APPLICATION_ENV") || define("APPLICATION_ENV", (getenv("APPLICATION_ENV") ? getenv("APPLICATION_ENV") : "production"));
	
	// Create application, bootstrap, and run
	$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . "/configs/application.ini");
	$controller = Zend_Controller_Front::getInstance();
	$controller->throwExceptions(true); 
	$controller->setParam("noViewRenderer", true);
		
	$resource = $application->getBootstrap()->getPluginResource("db");
	$db = $resource->getDbAdapter();
	Zend_Registry::set("DB", $db);
	
	$smarty = new STE_Smarty(APPLICATION_PATH . "/../templates");
	Zend_Registry::set("SMARTY", $smarty);
	
	Zend_Session::start();
	
	$application->bootstrap()->run();
?>